<template>
  <div class="wrap" v-show="visible">
    <div class="close" @click="$emit('update:visible' , false)">关闭</div>
    <div class="swiper mySwiper" ref="swiperDom">
      <div class="swiper-wrapper">
        <div  
            v-for="item in list" 
            :key="item"
            class="swiper-slide"
            >
            <img :src="item" alt="">
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import Swiper from 'swiper'
import 'swiper/css';


export default {
    props:['list','visible'],
    watch: {
        visible() {
            if(this.visible) {
                new Swiper(this.$refs.swiperDom)
            }
        }
    }
}
</script>

<style lang="scss" scoped>
.wrap{
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    img {
        width: 100%;
    }
}
.close {
    position:absolute;
    top: 0;
    left: 0;
    width: 50px;
    height: 50px;
    line-height: 50px;
    text-align: center;
    color: #FFF;
    z-index: 99;
}
.swiper-slide {
    display: flex;
    align-items: center;
    height: 100vh;
}
</style>